package com.rin.design_pattern.abstract_factory;

import com.rin.design_pattern.common.color.*;
import com.rin.design_pattern.common.shape.*;

/**
 * @author RinMi
 * @since 2023/5/26
 */
public class ColorFactory extends AbstractFactory{
   @Override
   public Shape getShape(String shapeType) {
      return null;
   }

   @Override
   public Color getColor(String colorType) {
      if (colorType == null) {
         return null;
      }
      if (ColorType.RED.equals(colorType)) {
         return new Red();
      }
      if (ColorType.GREEN.equals(colorType)) {
         return new Green();
      }
      if (ColorType.BLUE.equals(colorType)) {
         return new Blue();
      }
      System.err.println("颜色: \"" + colorType + "\"不存在");
      return null;
   }
}
